package com.zhanghe.im.console;

import com.zhanghe.im.request.CreateGroupRequestPacket;
import io.netty.channel.Channel;

import java.util.Arrays;
import java.util.Scanner;

public class CreateGroupConsoleCommand implements ConsoleCommand {

    @Override
    public void exec(Scanner scanner, Channel channel) {
        System.out.print("输入 userId 列表，userId 之间英文逗号隔开:");
        String users = scanner.next();
        CreateGroupRequestPacket createGroupRequestPacket = new CreateGroupRequestPacket();
        createGroupRequestPacket.setUsers(Arrays.asList(users.split(",")));
        channel.writeAndFlush(createGroupRequestPacket);
    }
}
